package com.crane.oss.sys.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.crane.oss.sys.dao.UserPartyDao;
import com.crane.oss.sys.model.UserParty;
import com.crane.oss.sys.service.UserPartyService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("userPartyService")
public class UserPartyServiceImpl implements UserPartyService {

    private static final Logger logger = LoggerFactory.getLogger(UserPartyServiceImpl.class);

    @Resource
    protected UserPartyDao userPartyDao;

    @Override
    public void deleteByUserId(Long userId) {
        logger.info("userPartyService deleteByUserId id={}", userId);
        userPartyDao.delete(Wrappers.lambdaUpdate(UserParty.class).eq(UserParty ::getUserId,userId));
    }

    @Override
    public void deleteByPartyId(Long partyId) {
        logger.info("userPartyService deleteByPartyId id={}", partyId);
        userPartyDao.delete(Wrappers.lambdaUpdate(UserParty.class).eq(UserParty ::getPartyId,partyId));
    }

}
